package com.jy.rhin.facade.cda;

import com.jy.api.patient.PatientAPI;
import com.jy.api.patient.dto.PatientIndexDto;
import com.jy.framework.base.entity.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Objects;

/**
 * @ename wade.nie
 * @cname 聂敏
 * @email 550552699@qq.com
 * @date 2024/7/17
 */
@Slf4j
@RequestMapping("/patient")
@Api(tags = "病人相关api")
@RestController
public class PatientController {


    @Autowired
    private PatientAPI patientAPI;

    /**
     * @param xingMing    姓名
     * @param zhengJianHM 证件号
     * @param type        1身份证 2empi
     * @return
     * @throws Exception
     */
    @ApiOperation("病人索引empi关系-多参")
    @GetMapping("/getByXingMingOrZJHM")
    public Result<List<PatientIndexDto>> patientIndexs(@RequestParam String xingMing, @RequestParam Integer type, @RequestParam String zhengJianHM) throws Exception {
        return patientAPI.patientIndexs(xingMing, type, zhengJianHM);
    }

    @ApiOperation("病人索引empi关系-empi")
    @GetMapping("/patientIndexByEmpi")
    public Result<PatientIndexDto> patientIndexByEmpi(@RequestParam("empi") String empi) throws Exception {
        return patientAPI.patientIndex(empi);
    }
}
